#ifndef INCLUDED_MAP_H
#define INCLUDED_MAP_H

#include <SGE.h>

using namespace SGE;

class Map
{
	private:
		int* mpTiles;

		int mColumns;
		int mNumSprites;
		int mRows;
		int mTileSize;

		SGE_Sprite* mpSprites;

		bool LoadLevel       (const char* pLevel);
		bool LoadTexturePack (const char* pTexturePack);
		bool IsBlocked		 (int x, int y) const;
		int GetIndex         (int x, int y) const;

		SRect GetBoundingBox (int x, int y) const;

	public:
		Map ();
		~Map ();
		
		void Load   (const char* pLevel, const char* pTexturePack);
		void Render (const SVector2& screenOffset);
		void Unload ();
		void Update (float deltaTime);

		bool TestCollision (const SLineSegment& segment, SRect& rect) const;

		int GetHeight () const {return (mRows * mTileSize);}
		int GetWidth  () const {return (mColumns * mTileSize);}
};

#endif